const mongoose = require('mongoose')

// 编辑留言板集合规则
const collectionSchema = new mongoose.Schema({
    // 文章分类id
    category: {
        type: mongoose.Schema.Types.ObjectId,
        // 将文章与分类集合关联
        ref: 'CollectionCategory',
        required: [true, '请传递分类id']
    },
    name: {
        type: String
    },
    description: {
        type: String
    },
    imageUrl: {
        type: String
    },
    url: {
        type: String
    }
})

// 创建评论集合规则
const Collection = mongoose.model('Collection', collectionSchema)

// 将评论集合构造函数作为模块成员进行导出
module.exports = {
    Collection
}
